import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:online_study/bean/special.dart';
import 'package:online_study/home/special/special_details.dart';
import 'package:online_study/home/special_item.dart';
import 'package:online_study/theme/size.dart';
//首页专题
class HomeSpecial extends StatefulWidget {
  @override
  _HomeSpecialState createState() => _HomeSpecialState();
}

class _HomeSpecialState extends State<HomeSpecial> {
  List<Special> data = [];

  @override
  void initState() {
    super.initState();
    data.add(Special(
        image:
            "https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg"));
    data.add(Special(
        image:
            "https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg"));
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: ThemeSize.width9),
      child: ListView.builder(
        itemBuilder: (BuildContext context, int index) {
          return GestureDetector(
            child: SpecialItem(data[index]),
            onTap: () {
              Get.to(() => SpecialDetailsPage());
            },
          );
        },
        itemCount: data.length,
        physics: NeverScrollableScrollPhysics(),
        shrinkWrap: true,
      ),
    );
  }
}
